/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package app.entities.model.MockDAOImpl;

import app.entities.MOCK.MockPersistencia;
import app.entities.model.DAO.TurmaDAO;
import app.entities.model.DTO.TurmaDTO;
import java.util.ArrayList;

/**
 *
 * @author Murilo
 */
public class MockTurmaDAOImpl implements TurmaDAO {

    @Override
    public void salvar(TurmaDTO dto) {
        MockPersistencia.getInstanciaListaTurmas().add(dto);
    }

    @Override
    public void deletar(TurmaDTO dto) {
        MockPersistencia.getInstanciaListaTurmas().remove(dto);
    }

    @Override
    public void atualizar(TurmaDTO dto) {
        for(TurmaDTO turma : MockPersistencia.getInstanciaListaTurmas()){
            if(turma.getId() == dto.getId()){
                turma.setBimestres(dto.getBimestres());
                turma.setAlunos(dto.getAlunos());
                turma.setNomeMateria(dto.getNomeMateria());
                turma.setProfessor(dto.getProfessor());
                turma.setListaPresenca(dto.getListaPresenca());
            }
        }
    }

    @Override
    public ArrayList listar() {
        return MockPersistencia.getInstanciaListaTurmas();
    }
}
